home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / lisp / ilisp / ilisp-cpat.el.z / ilisp-cpat.el
Encoding:
Text File  |  1998-05-21  |  3.6 KB  |  129 lines

  1. ;;; -*- Mode: Emacs-Lisp -*-
  2.  
  3. ;;; ilisp-cpat.el --
  4.  
  5. ;;; This file is part of ILISP.
  6. ;;; Version: 5.8
  7. ;;;
  8. ;;; Copyright (C) 1990, 1991, 1992, 1993 Chris McConnell
  9. ;;;               1993, 1994 Ivan Vasquez
  10. ;;;               1994, 1995, 1996 Marco Antoniotti and Rick Busdiecker
  11. ;;;               1996 Marco Antoniotti and Rick Campbell
  12. ;;;
  13. ;;; Other authors' names for which this Copyright notice also holds
  14. ;;; may appear later in this file.
  15. ;;;
  16. ;;; Send mail to 'ilisp-request@naggum.no' to be included in the
  17. ;;; ILISP mailing list. 'ilisp@naggum.no' is the general ILISP
  18. ;;; mailing list were bugs and improvements are discussed.
  19. ;;;
  20. ;;; ILISP is freely redistributable under the terms found in the file
  21. ;;; COPYING.
  22.  
  23.  
  24.  
  25. ;;;
  26. ;;;
  27. ;;; Compatability between GNU emacs 18, 19, and Lucid emacs 19.
  28. ;;;
  29. ;;;
  30. (defconst ilisp-emacs-version-id
  31.   (cond ((string-match "Lucid" emacs-version)
  32.      (if (string-match "^19.[0-7][^0-9]" emacs-version)
  33.          'lucid-19
  34.        'lucid-19-new))
  35.     ((string-match "^19" emacs-version)
  36.      'gnu-19)
  37.     (t 'gnu-18))
  38.   "What version of emacs we are running.")
  39.  
  40.  
  41. ;; Hook stuff--this should really be a part of emacs-lisp anyway
  42.       
  43. (defun ilisp-member (elt list)
  44.   (let ((result nil))
  45.     (while list
  46.       (cond ((equal elt (car list))
  47.          (setq result list
  48.            list nil))
  49.         (t
  50.          (setq list (cdr list)))))
  51.     result))
  52.     
  53.  
  54. (defun ilisp-add-hook (hook function)
  55.   "Arguments are HOOK and FUNCTION. Add FUNCTION to HOOK's list.
  56. FUNCTION is not added if it's already on the list."
  57.   (set hook
  58.        (if (boundp hook)
  59.        (let ((value (symbol-value hook)))
  60.          (if (and value (or (not (consp value)) (eq (car value) 'lambda)))
  61.          (setq value (cons value nil)))
  62.          (if (not (ilisp-member function value))
  63.          (setq value (append value (list function))))
  64.          value)
  65.      (list function))))
  66.  
  67. (if (not (fboundp 'add-hook))
  68.     (fset 'add-hook 'ilisp-add-hook))
  69.  
  70.  
  71. ;;; 'ilisp-where-is' has been moved (and corrected) to ilisp-key.el.
  72.  
  73. ;;;
  74. ;;; COMINT 
  75. ;;;
  76. ;;; GNU, Lucid and 18 use different versions of comint with
  77. ;;; incompatible interface variables and functions.  Hooray.
  78. ;;;
  79.  
  80. ;; Some very old COMINT versions are missing these.
  81. (if (not (boundp 'comint-input-chunk-size))
  82.     (setq comint-input-chunk-size 512))
  83. (if (not (boundp 'comint-ptyp))
  84.     (setq comint-ptyp t))
  85.  
  86.  
  87. (defun ilisp-get-input-ring ()
  88.   "Use instead of get-input-ring coming-input-ring or input-ring."
  89.   (cond ((eq ilisp-emacs-version-id 'lucid-19)
  90.      (get-input-ring))
  91.     ((or (eq ilisp-emacs-version-id 'gnu-19)
  92.          (eq ilisp-emacs-version-id 'lucid-19-new))
  93.      comint-input-ring)
  94.     (t input-ring)))
  95.  
  96. (defun ilisp-ring-insert (ring input)
  97.   (if (eq ilisp-emacs-version-id 'lucid-19)
  98.       (ring-insert-new ring input)
  99.       (ring-insert ring input)))
  100.  
  101. (defun ilisp-temp-buffer-show-function ()
  102.   (if (eq ilisp-emacs-version-id 'gnu-18) 
  103.       temp-buffer-show-hook
  104.     temp-buffer-show-function))
  105.  
  106. (defun ilisp-input-ring-index ()
  107.   (if (or (eq ilisp-emacs-version-id 'gnu-19)
  108.       (eq ilisp-emacs-version-id 'lucid-19-new))
  109.       comint-input-ring-index
  110.     input-ring-index))
  111.  
  112. (defun set-ilisp-input-ring-index (n)
  113.   (if (or (eq ilisp-emacs-version-id 'gnu-19)
  114.       (eq ilisp-emacs-version-id 'lucid-19-new))
  115.       (setq comint-input-ring-index n)
  116.     (setq input-ring-index n)))
  117.  
  118. (defun ilisp-input-ring-size ()
  119.   (if (or (eq ilisp-emacs-version-id 'gnu-19)
  120.       (eq ilisp-emacs-version-id 'lucid-19-new))
  121.       comint-input-ring-size
  122.     input-ring-size))
  123.  
  124. (defun set-ilisp-input-ring-size (n)
  125.   (if (or (eq ilisp-emacs-version-id 'gnu-19)
  126.       (eq ilisp-emacs-version-id 'lucid-19-new))
  127.       (setq comint-input-ring-size n)
  128.     (setq input-ring-size n)))
  129.